package sample.spring.ibatis.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import sample.spring.ibatis.model.User;
import sample.spring.ibatis.service.IUserService;

import java.util.List;
import java.util.Map;

/**
 * Created by yangyang on 15/10/2.
 */
@RestController
@RequestMapping(value = "/user/")
public class UserController {

    @Autowired
    IUserService userService;

    @RequestMapping(value="/all",method = RequestMethod.GET)
    @ResponseBody
    public String getAllUser() {
//        return userService.getAllUsers();
        String jsonString = JSON.toJSONString(userService.getAllUsers());
        return jsonString;
    }


}
